home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
015a
/
dosimp10.zip
/
SIMPLY2.HYP
< prev
next >
Wrap
Text File
|
1991-08-12
|
118KB
|
1,999 lines
The |tEDLIN|t Line Editor
An awful lot of people go around these days saying that |nEDLIN|n is a lou-
sy rotten piece of junk. Well, ok, it's a pretty sad excuse for a text
editor, but until you get something better, |nEDLIN|n will work just fine.
It's free with DOS, after all. And it's not a bit hard to learn, like
everybody says it is. (If you have DOS version 5, use EDIT instead.)
It's called a line editor because it works with one line of text at a
time. So it displays files with line numbers next to each line, and
these are the numbers you use to work with the lines.
The syntax of the command is really simple. You just type the command
followed by the name of the file you want to edit or create. If the file
is not in the current directory, you specify the |spath|sname as well as the
filename. For example,
|nEDLIN|n C:\AUTOEXEC.BAT
|nEDLIN|n is especially good for working with AUTOEXEC.BAT and CONFIG.SYS
<page down> for more
EDLIN continued
files, because |nEDLIN|n makes 100% ASCII files. If you were to use a word
processor to create these configuration files, you would have to remember
to save the file in the word processor's version of text, |nASCII|n, or non-
document mode, because word processors insert all sorts of special sym-
bols into the file, to tell it where the margins are, where the words
should be in boldfaced type, things like that. If you tried to use a
file like that as a DOS file, DOS would just have a fit! DOS only wants
to deal with plain old straight |nASCII|n text, and that's just what |nEDLIN|n
gives to DOS.
When you enter the above command, |nEDLIN|n |nAUTOEXEC.BAT|n, if the file already
exists you will see "End of input file", or if the file does not exist
yet, you will see "New file". Then you will see |nEDLIN|n's prompt, which is
just an asterisk (*).
Another use that |nEDLIN|n has for the asterisk is to mark the |ncurrent|n line.
The |ncurrent|n line is the one that was most recently edited. When you
first open a file, the |ncurrent|n line is line one. But after that, most
<page down> for more
EDLIN continued
commands that you use will change the |ncurrent|n line to the one you per-
formed the command on. So that line will be the one with the asterisk.
Now if you enter a command without any line number, the command will be
performed on the |ncurrent|n line. Of course it's always safest to include
the line number in the command, but leaving it out and just having it
default to the |ncurrent|n line is a convenient shortcut for after you become
really familiar with |nEDLIN|n.
A line in |nEDLIN|n can be as long as 253 characters. If the text you are
putting on a line reaches the right edge of the screen, it will wrap
around to the next line of the screen, but it is still on the same line
number until you press <Enter> to end the line.
There are some special |tediting keys|t that you can use in |nEDLIN|n, and these
same keys can be used in the same way at the DOS command line as well.
The difference is that in |nEDLIN|n, these special keys allow you to bring
down the previous line and make changes to it, and in DOS these keys al-
<page down> for more
EDLIN continued
low you to edit and re-execute the last command you entered. You see,
there is a thing called a "template", and in DOS, the template is DOS's
|nmemory|n of the last command you executed. In |nEDLIN|n, the template is DOS's
|nmemory|n of the last line that you edited, or if you're editing a line now,
then the template is the line that was at that line number before you
started changing it. Well the editing keys let you work with whatever
is in the template.
For example, the <F1> key will place the first character of the previous
line onto the |ncurrent|n line. Then if you hit the <F1> key again, the sec-
ond character from the previous line will be copied to the |ncurrent|n line.
The <F3> key copies the entire previous line, from the position of the
cursor to the end of the line, to the |ncurrent|n line. And the <F2> key,
followed by some character, copies all the characters from the previous
line, up until the character that you typed after the <F2> key. For ex-
ample, suppose you are editing line number 4:
4: Hello, there. How are you doing?
4:*_
<page down> for more
EDLIN continued
Now if you were to hit the <F1> key five times, here's what you'd get:
4: Hello, there. How are you doing?
4:*Hello_
Then if you hit the <F2> key immediately followed by the <w> key:
4: Hello, there. How are you doing?
4:*Hello, there. Ho_
And if you hit the <F3> key, you'd get this:
4: Hello, there. How are you doing?
4:*Hello, there. How are you doing?_
Now suppose you wanted to change that line to "How the heck are you do-
ing?" First you'd hit <F2> <a> to copy all of the line up to the first
"a" down to the |ncurrent|n line. Then hit the <Insert> key to toggle the
insert mode on. Now everything you type will be inserted into the pre-
vious line. So type "the heck ". Then if you hit the <F3> key, the
words "are you doing?" will be copied to the |ncurrent|n line.
Then suppose you decide you don't want that "the heck" in there after
all. So edit line four again and hit <F2> <t> <F2> <t>:
<page down> for more
EDLIN continued
4: Hello, there. How the heck are you doing?
4:*Hello, there. How _
Now what you want to do is delete the next 8 characters, right? So just
hit the <Delete> key 8 times, and then <F3> and here's what you've got:
4: Hello, there. How the heck are you doing?
4:*Hello, there. How are you doing?_
Those same keys work the same way from one line number to the next.
Suppose you want to write some lines that look like this:
5: See page 428 for more information.
6: See page 486 for more information._
Well, to do that, you first write line number 5 like that, and then when
you get to line 6, just hit <F2> <2> and type <8> <6> and <F3>.
Now the <F4> key is also pretty interesting. It does pretty much the ex-
act opposite of the <F2> key. You type <F4> and some character key, and
all the characters up until that character you typed get deleted, and the
character you typed becomes the first character in the line, and the rest
<page down> for more
EDLIN continued
of the line is copied to the |ncurrent|n line as well. For example:
4: Hello, there. How the heck are you doing?
4:*_
Now if you were to type <F1> <i> <F4> <,>, then you'd end up with this:
4: Hello, there. How the heck are you doing?
4:*Hi, there. How the heck are you doing?_
Ok, we also have the <F5> key. What that does is to copy the |ncurrent|n
line into the template without executing it. Without the <F5> key, the
only way to edit the |ncurrent|n line is to backspace over everything you've
already typed, change the little mistake, and then retype the rest of the
line again. Yuk. Well with <F5>, you can just put the line you're work-
ing on into the template, and then use the editing keys on it as if it
were the previous line instead of the |ncurrent|n line. The problem is, you
have to have a good |nmemory|n because as soon as you hit <F5>, the line dis-
appears from the screen. You have to remember what it said to be able to
edit it without seeing it. That's only the case at the DOS command line,
though. In |nEDLIN|n, the line doesn't disappear when you hit <F5>. Instead
<page down> for more
EDLIN continued
a little @ symbol appears at the end, and the cursor moves down one line:
4:*Hello, there. How the hedk are you doing?@
_
See where the @ appeared when I hit <F5>? Now that whole line, except
for the @, is in the template and the cursor dropped down so I could try
again, without the typo. So if I hit <F2> <d> <c> <F3> then I have this:
4:*Hello, there. How the hedk are you doing?@
Hello, there. How the heck are you doing?_
Well that works the same way at the DOS command prompt, except that once
you hit <F5> you can't see the line that you're editing like you can in
|nEDLIN|n.
Next, there is the <F6> key. This inserts a ^Z End-of-File character
into whatever you're typing. The main use you'll ever have for that is
when you're using COPY CON FILENAME to create a little text file without
using |nEDLIN|n or anything.
Then there's the <F7> key, which places a null character, ASCII code 0,
<page down> for more
EDLIN continued
into your text. This will look like ^@ on the screen when you first type
it, but in general the null character is just a blank. It's useful for
causing the ECHO command to display a blank line during a batch file.
And last but not least, there's the <Esc> key, which will just cancel
the line you were typing and give you a blank line to start over on.
Another special key combination that can be useful in |nEDLIN|n, is <Ctrl-V>.
What that does, is to tell |nEDLIN|n that the next character you type should
be considered to be a control character. For example, if you were to
type <Ctrl-V> followed by the [ character, |nEDLIN|n would put ^[ into the
file, which represents the ESCape character, which is used to get the
attention of the ANSI.SYS device driver, or of your printer.
Another type of special character that you can enter into a file with ED-
LIN, is box-drawing characters. To enter an ASCII character number 206,
which looks like this, ╬, you just hold down the <Alt> key while typing
the numbers 2, 0, and 6 on the numeric keypad, then let go of the <Alt>
<page down> for more
EDLIN continued
key. You can use these characters to make some decent-looking boxes and
menus. For example, the top line of a double box: ╔════════╦════════╗
Since everything you do in |nEDLIN|n depends on the line numbers of the text
lines, remember every time you change something, use the L or P command
to display the file again, to see what the new line numbers are. Because
whenever a line is inserted or deleted, that changes the line numbers for
all the lines after that point in the file. If you were to delete what
used to be line number 27, you'd be deleting the wrong line, because
since you inserted some other line before line 27, now what used to be
line 27 is now line 28. Always remember to redisplay the line numbers
after making any changes, before making any more changes.
Ok, here are the most-often-used |nEDLIN|n commands:
To edit a line that already exists, just enter its line number as a com-
mand. |nEDLIN|n will show you the line as it presently exists, and right un-
der that, a blank line with the same line number, which is where you type
<page down> for more
EDLIN continued
what you now want the line to say. Hit <Enter> when you're done. Then
if you also want to edit the very next line, you can just hit <Enter>
again; you don't have to type the next line number first.
C (copy) To make another copy of some range of lines. If you wanted to
put another copy of lines 4 through 8 right before line 23, the command
to do that would be 4,8,23C.
D (delete) To delete a line or a range of lines. If you want to delete
the line that has number 6 beside it, the command would be 6D. If you
wanted to delete lines 6 through 12, the command would be 6,12D.
E (end) This is the command you use when you've got the file all done,
and you want to go back to DOS. |nEDLIN|n will make a |nbackup|n copy of the
file the way it was before you started editing, and name that file with
the same name, only with a .BAK extension. Then it will save the file to
disk under the name you called it when you started the |nEDLIN|n command.
<page down> for more
EDLIN continued
I (insert) This is the command you use to insert any line into a file.
If you've just started creating a brand new file, I is the first command
you want to use. If you're editing a file that already exists, and you
want to insert a line right before line number 6, then the command would
be 6I. If you want to add a line to the end of the file, the command
would be #I because the # symbol in |nEDLIN|n always means "the line number
right after the last line number that exists in the file". To insert a
line right before the |ncurrent|n line, use .I, because the . symbol in |nEDLIN|n
means the |ncurrent|n line. Or you could just use I because if no line num-
ber is specified, |nEDLIN|n |sdefault|ss to the |ncurrent|n line. When you're done
inserting lines, you get out of insert mode by using the <Enter> key to
make sure you're on a blank line, then you use the <Ctrl-C> combination.
This will take you back to the * prompt at the left edge of the screen,
where you can use any of the other |nEDLIN|n commands to do some more editing
or to display the file, or whatever you want to do.
L (list) This command is used to display the lines in the file. If you
want to display lines 8 through 15, the command would be 8,15L. If you
<page down> for more
EDLIN continued
leave out the ending line number, and just type 8L, then |nEDLIN|n will dis-
play 23 lines starting with line 8. What's different between the L com-
mand and the P command, is that use of the L command does not change the
|ncurrent|n line number. If line 9 was |ncurrent|n before you used the L command
then line 9 will still be |ncurrent|n afterward.
M (move) This command can be used to move a line or a block of lines
from one location to another in a file. If you want to move the lines 3
through 16, to a position just before line 1, then the command would be
3,16,1M. If you only wanted to move line 3 to a position before line 1,
the command would be 3,3,1M. In that case, line 3 is both the starting
line and the ending line for the block of lines to be moved.
P (page) This command displays 23 lines of the file. If you use a line
number, as in 5P, then lines 5 through 27 will be displayed. But if you
leave out the line number, the |ncurrent|n line and the next 22 lines will be
displayed. When the P command is used, the last line displayed becomes
the |ncurrent|n line. Therefore, if you immediately give another P command,
<page down> for more
EDLIN continued
without a line number, the next 23 lines will be displayed automatically.
Q (quit) This is the command to use to exit from |nEDLIN|n without saving
the file. If you've made a bunch of goofs, just enter Q and the copy of
the file on the disk will remain exactly as if you hadn't edited it at
all.
R (replace) This is the command you use to search-and-replace one
string of text with another. Suppose you want to change all of the oc-
currences of the word "Michael" between lines 5 and 32 with the word
"Mike". Here's the command:
5,32 ? RMichael<F6>Mike
The ? in that command causes |nEDLIN|n to stop and ask you, on each line that
contains the word "Michael", whether you really want to replace it with
"Mike". If you wanted to change all the occurrences of Mike Jones with
Mike, you could either use 5,32 ? RMike Jones<F6>Mike, or you could use
5,32 ? R Jones<F6> which would replace " Jones" with "nothing at all".
Notice that the only time you include a <Space> in the search string or
<page down> for more
EDLIN continued
replace string, is when you want a <Space> to be one of the characters
that gets searched or replaced. Otherwise, there must never be a <Space>
right after the R command.
Whenever you hit the <F6> key, you will see ^Z on your screen. ^Z means
<Ctrl-Z> and <F6> is a shortcut for <Ctrl-Z>. So if for some reason you
can't use the <F6> key, like if you have used ANSI.SYS to reassign the
<F6> key to some other string, you can just use <Ctrl-Z> in its place.
S (search) This command will show you every line which contains the
text you want to search for. If you want to find every occurrence of the
word "Michael" from line 5 through line 32, the command would be:
5,32 ? SMichael
The ? makes |nEDLIN|n ask you, after displaying each line, if you want to end
the search or not. If you say Y(es), the line becomes the |ncurrent|n line
and the search ends. If you hit any key besides <Y>, the search contin-
ues. If you don't use the ? parameter |nEDLIN|n will only show you the first
occurrence of that text that it finds. Remember that the search is case
<page down> for more
EDLIN continued
sensitive, so if you search for Michael, MICHAEL won't be found.
T (transfer) This command will import another ASCII file into the one
you're currently editing. This file has to be in the current directory,
though it doesn't have to be on the |ncurrent|n drive. And it really does
have to be a pure |nASCII|n file. Suppose you have a file named A:HELLO.TXT
and you want to insert it just before line 6 of the file you're editing,
6TA:HELLO.TXT
will do it.
If you enter the |nEDLIN|n command with the /B switch, as in |nEDLIN|n FILE /B,
you can edit all of a file that has an End-of-File character embedded in
it. (See the section about the COPY command.) Because the /B, which
stands for Binary, means that |nEDLIN|n will look in the file's |ndirectory|n en-
try to see how long the file is, rather than just editing whatever comes
before the first End-of-File character, which would, by the way, remove
all the text that came after that End-of-File character if you were to
save the file back to disk after not using the /B switch. Also, |nEDLIN|n
does put the EOF character on the end of every file you edit with it!
The |TRESTORE|T Command
This is the command that you must use in order to get your files back
from your floppy disks after you've backed them up. The BACKUP command
puts all the files it backs up into one great big file, so |nRESTORE|n is the
only way you'll ever see those files again, if your hard drive dies.
The syntax of the |nRESTORE|n command is like this:
|nCOMMAND|n SOURCE TARGET SWITCHES
just like most DOS commands. So let's discuss those parts one at a time.
The command is |nRESTORE|n, but like any external command, if the |nRESTORE|n.COM
file is neither in the current directory nor in a |ndirectory|n on your PATH,
then you'll have to specify the entire pathname to the command as part of
the command. That means you might say C:\DOS\RESTORE instead of |nRESTORE|n.
The source is the drive where the files are, that you want to have res-
tored to the hard drive. Usually just A: or B:.
<page down> for more
RESTORE continued
The target is where you want the files to end up. If you want to restore
the entire hard drive, then the target would be C:\*.*. If you want to
restore only the files that start with BR in the \BROWN subdirectory, the
target would be C:\BROWN\BR*.*. (See also Wildcards.)
The hardest part to figure out, about the |nRESTORE|n command, is that the
filenames and the directory structure are stored as part of the backup
disks, and that's the way they get restored. If you used to keep your
word processing program in a |ndirectory|n named \WORD, back when you made
the |nbackup|n |ndisks|n, and nowadays you keep it in a |ndirectory|n named \WP, then
if you use the command |nRESTORE|n A: C:\WP\*.* then the |nRESTORE|n command is
going to give you a nasty error message like "No files found to restore",
because you didn't have any files named \WP\*.* at the time you made the
|nbackup|n |ndisks|n. Those files used to be called \WORD\*.* instead. So in
order to restore them, you'll have to use |nRESTORE|n A: C:\WORD\*.* and the
|nRESTORE|n command will create a |ndirectory|n called C:\WORD and put the files
there, and then you'll have to use the COPY command to put them into the
\WP |ndirectory|n, then delete the files from the \WORD |ndirectory|n and RMDIR
<page down> for more
RESTORE continued
the \WORD directory. Restoring those files to D:\WORD wouldn't have been
a bit of a problem though. Different drive but same |ndirectory|n, is ok.
So, what switches are available with the |nRESTORE|n command? Quite a few:
/S /P /N /M /A:date /B:date /L:time /E:time
The /S switch tells DOS to also restore the files in the subdirectories
of the target |ndirectory|n. If you had a |ndirectory|n named C:\WORD\LETTERS
below your C:\WORD |ndirectory|n, and you used C:\WORD\*.* as the target of
the |nRESTORE|n command, then if you leave out the /S switch, the files in
C:\WORD\LETTERS will not be restored, or if you include the /S switch,
then they will be restored. If you want to restore all the files on your
entire hard drive, then you always have to specify the /S switch, as well
as using C:\*.* as your target.
The /P switch tells DOS to pause and ask you for confirmation every time
it encounters any files that either have their Read-only attributes set
on the target drive, or that have a more recent copy on the target drive
than the copy on the backup disk. In most cases, if the copy on the tar-
<page down> for more
RESTORE continued
get drive is newer than the copy on the backup disk, then you probably do
not want |nRESTORE|n to overwrite the newer copy with the older copy. How-
ever, if you know that the newer copy on the target drive has been ruined
in some way, then yes, you do want to restore the older copy.
The /N switch only came into existence with version 3.3 of DOS, and it's
about time! This switch will find all the files that exist on the |nbackup|n
disks, that no longer exist on the target disk. That means if you delete
a bunch of files accidentally, you can just restore them from the |nbackup|n
|ndisks|n without going through a complete restore! There is one very small
problem with this, however. If you have renamed a file since you made
the |nbackup|n, the /N switch of |nRESTORE|n will find that the file (under its
old name) no longer exists on the target disk (because it now has some
other name) so it will restore that file. So now you have the old copy
of the file, under its old name, as well as the |ncurrent|n copy of the file,
under its new name. That's a waste of hard disk space! So be sure and
check for this sort of thing whenever you use the /N switch with |nRESTORE|n,
and delete the old copies of renamed files.
<page down> for more
RESTORE continued
The /M switch does the same thing as the /N switch, and more! It also
restores any files that have been changed since the backup was made. It
will replace the more recent copy of the file, with the old out-of-date
copy. This is useful for when you've made some sort of a big goof and
messed up all your hard drive's data files, and you need to get back the
old copies from before you did that.
The next four switches are all new with version 3.3 of DOS, and they all
have to do with time. The /A switch will restore all the files from the
|nbackup|n disks that have a date that's the same or later than the date you
specify with the /A:date switch. The /B switch will restore all of the
files whose date is the same or earlier than the date you specified. The
/L:time and /E:time switches must only be used with the /A or /B switch.
/L means files that have the same time or a later time than the one you
specify, and /E means files whose time is the same or earlier than the
one you specified.
Before version 3.3 of DOS, the |nBACKUP|n command backed up the Hidden Files,
<page down> for more
RESTORE continued
which are IO.SYS and MSDOS.SYS for MS-DOS, or IBMBIO.COM and IBMDOS.COM
for PC-DOS, so that if you upgraded to a new DOS version, and then you
needed to restore some files from your old backup disks, you would have
to be very careful to see that |nRESTORE|n didn't try to put your old Hidden
files back on the disk, right over top of the ones from your new DOS ver-
sion! If you still have version 3.2 or an earlier version, then watch
out for this. But of course now that Microsoft is selling DOS version
5.0 right to the public, instead of only to computer dealers, there's no
reason for you to stick with an old version. DOS 5 is fantastic!
Many previous versions of the DOS |nRESTORE|n command could only restore
files that were made by the |nBACKUP|n command from that same DOS version.
But not DOS 5.0! It can restore |nbackup|n files from DOS 2.11 or later.
There is also a new switch for the DOS 5 |nRESTORE|n command. The /D switch
will show you what files will be restored by the command you are entering
but it will not restore any files. Use the command with the /D switch
first, as a test, and if it shows you the right filenames, you enter the
same command again, only without the /D switch, to restore them.
What Is |tASCII|t?
|nASCII|n stands for American Standard Code for Information Exchange. It's
pronounced "ASK-ee". It's like a common ground on which different types
of programs can communicate.
Say you have some data in a database, that you want to use in your spread
sheet. Well databases and spreadsheets generally speak two different
languages. But they both have one language in common. You can export
the database data into an |nASCII|n file, and import that |nASCII|n file into
your spreadsheet, and then your spreadsheet will be able to understand
the database data!
An |nASCII|n file is just a text file that a human being could read, as op-
posed to one of those files that just looks like total gibberish if you
look at it with the TYPE command.
An |nASCII|n file is the only type of file that DOS can read, when it comes
to |sbatch file|ss and things like that. To make an |nASCII file|n, you can use
<page down> for more
ASCII continued
any text editor, or your word processor also, if you can find the command
that your word processor uses to export an |nASCII|n file. Some word proces-
sors make it easy by calling it "export", or "ASCII", or "text", but
other word processors have to be difficult and call it something incom-
prehensible like "non-document mode" or "unformatted files".
Well, now I suppose you want to see this set of codes that's known as
|nASCII|n, right? Ok, get ready, here are the decimal |nASCII|n codes.
Non-printing characters: (These don't really count for a text file, but
they still are part of the |nASCII|n standard.)
0 ^@ |nNUL|n null 7 ^G BEL bell 14 ^N SO
1 ^A SOH 8 ^H BS <Backspace> 15 ^O SI
2 ^B STX 9 ^I HT <Tab> 16 ^P DLE
3 ^C ETX 10 ^J LF linefeed 17 ^Q DC1
4 ^D EOT 11 ^K VT 18 ^R DC2
5 ^E ENQ 12 ^L FF formfeed 19 ^S DC3
6 ^F ACK 13 ^M CR <Enter> 20 ^T DC4
<page down> for more
ASCII continued
21 ^U NAK 25 ^Y EM 29 ^` GS
22 ^V SYN 26 ^Z EOF End-of-File 30 ^= RS
23 ^W ETB 27 ^[ ESC ESCape 31 ^- US
24 ^X CAN cancel 28 ^\ FS
Printing characters:
32 <Space> 44 , 56 8 68 D 80 P 92 \ 104 h
33 ! 45 - 57 9 69 E 81 Q 93 ] 105 i
34 " 46 . 58 : 70 F 82 R 94 ^ 106 j
35 # 47 / 59 ; 71 G 83 S 95 _ 107 k
36 $ 48 0 60 < 72 H 84 T 96 ` 108 l
37 % 49 1 61 = 73 I 85 U 97 a 109 m
38 & 50 2 62 > 74 J 86 V 98 b 110 n
39 ' 51 3 63 ? 75 K 87 W 99 c 111 o
40 ( 52 4 64 @ 76 L 88 X 100 d 112 p
41 ) 53 5 65 A 77 M 89 Y 101 e 113 q
42 * 54 6 66 B 78 N 90 Z 102 f 114 r
43 + 55 7 67 C 79 O 91 [ 103 g 115 s
<page down> for more
ASCII continued
116 t 118 v 120 x 122 z 124 || 126 ~
117 u 119 w 121 y 123 { 125 } 127 <Delete>
High-bit characters: (Also called IBM |nASCII|n |nextended|n characters.)
128 Ç 142 Ä 156 £ 170 ¬ 184 ╕ 198 ╞ 212 ╘
129 ü 143 Å 157 ¥ 171 ½ 185 ╣ 199 ╟ 213 ╒
130 é 144 É 158 ₧ 172 ¼ 186 ║ 200 ╚ 214 ╓
131 â 145 æ 159 ƒ 173 ¡ 187 ╗ 201 ╔ 215 ╫
132 ä 146 Æ 160 á 174 « 188 ╝ 202 ╩ 216 ╪
133 à 147 ô 161 í 175 » 189 ╜ 203 ╦ 217 ┘
134 å 148 ö 162 ó 176 ░ 190 ╛ 204 ╠ 218 ┌
135 ç 149 ò 163 ú 177 ▒ 191 ┐ 205 ═ 219 █
136 ê 150 û 164 ñ 178 ▓ 192 └ 206 ╬ 220 ▄
137 ë 151 ù 165 Ñ 179 │ 193 ┴ 207 ╧ 221 ▌
138 è 152 ÿ 166 ª 180 ┤ 194 ┬ 208 ╨ 222 ▐
139 ï 153 Ö 167 º 181 ╡ 195 ├ 209 ╤ 223 ▀
140 î 154 Ü 168 ¿ 182 ╢ 196 ─ 210 ╥ 224 α
141 ì 155 ¢ 169 ⌐ 183 ╖ 197 ┼ 211 ╙ 225 ß
<page down> for more
ASCII continued
226 Γ 231 τ 236 ∞ 241 ± 246 ÷ 251 √
227 π 232 Φ 237 φ 242 ≥ 247 ≈ 252 ⁿ
228 Σ 233 Θ 238 ε 243 ≤ 248 ° 253 ²
229 σ 234 Ω 239 ∩ 244 ⌠ 249 ∙ 254 ■
230 µ 235 δ 240 ≡ 245 ⌡ 250 · 255 blank
|nExtended|n characters: (These don't count for a text file but you may need
them for ANSI.SYS keyboard reassignment, and such things.) It takes two
codes put together to represent the following characters. The first code
is always the |nASCII|n null, which is 0, and the two codes are separated by
a semicolon (;). So to represent the <F10> key, whose |nkeyboard|n scan code
is 68, you would type 0;68.
1 Alt-ESC 18 Alt-E 24 Alt-O 31 Alt-S 37 Alt-K
3 Null 19 Alt-R 25 Alt-P 32 Alt-D 38 Alt-L
14 Alt-Backspace 20 Alt-T 26 Alt-[ 33 Alt-F 39 Alt-;
15 Shift-Tab 21 Alt-Y 27 Alt-] 34 Alt-G 43 Alt-\
16 Alt-Q 22 Alt-U 28 Alt-Enter 35 Alt-H 44 Alt-Z
17 Alt-W 23 Alt-I 30 Alt-A 36 Alt-J 45 Alt-X
<page down> for more
ASCII continued
46 Alt-C 65 F7 83 Delete 101 ^F8
47 Alt-V 66 F8 84 Shift-F1 102 ^F9
48 Alt-B 67 F9 85 Shift-F2 103 ^F10
49 Alt-N 68 F10 86 Shift-F3 104 Alt-F1
50 Alt-M 69 Numlock 87 Shift-F4 105 Alt-F2
51 Alt-, 70 Scroll Lock 88 Shift-F5 106 Alt-F3
52 Alt-. 71 Home 89 Shift-F6 107 Alt-F4
53 Alt-/ 72 Up 90 Shift-F7 108 Alt-F5
55 Alt-* (keypad) 73 Pg Up 91 Shift-F8 109 Alt-F6
56 Alt-Break 74 Alt-- (keypad) 92 Shift-F9 110 Alt-F7
57 Alt-Space 75 Left 93 Shift-F10 111 Alt-F8
58 Capslock 76 Shift-5 (keypad) 94 ^F1 112 Alt-F9
59 F1 77 Right 95 ^F2 113 Alt-F10
60 F2 78 Alt-+ (keypad) 96 ^F3 114 ^Prt Sc
61 F3 79 End 97 ^F4 115 ^Left
62 F4 80 Down 98 ^F5 116 ^Right
63 F5 81 Pg Dn 99 ^F6 117 ^End
64 F6 82 Insert 100 ^F7 118 ^Pg Dn
<page down> for more
ASCII continued
119 ^Home 134 F12 149 ^/ (keypad)
120 Alt-1 135 Shift-F11 150 ^* (keypad)
121 Alt-2 136 Shift-F12 151 Alt-Home
122 Alt-3 137 ^F11 152 Alt-Up
123 Alt-4 138 ^F12 153 Alt-Pg Up
124 Alt-5 139 Alt-F11 155 Alt-Left
125 Alt-6 140 Alt-F12 157 Alt-Right
126 Alt-7 141 ^Up/8 (keypad) 159 Alt-End
127 Alt-8 142 ^- (keypad) 160 Alt-Down
128 Alt-9 143 ^5 (keypad) 161 Alt-Pg Dn
129 Alt-0 144 ^+ (keypad) 162 Alt-Insert
130 Alt-- 145 ^Down/2 (keypad) 163 Alt-Delete
131 Alt-= 146 ^Insert/0 (keypad) 164 Alt-/ (keypad)
132 ^Pg Up 147 ^Delete/. (keypad) 165 Alt-Tab
133 F11 148 ^Tab 166 Alt-Enter (keypad)
Remember that a symbol such as ^Home means <Ctrl-Home> which means for
you to hold down one of the <Ctrl> keys while you hit the <Home> key.
How Do |tDisks|t Work?
The easiest way to think about |ndisks|n is like a phonograph record. You
know, like an album. A disk is a round thing with a hole in the middle,
that spins around and has the head (needle) of a drive (record player)
moving back and forth across it to read the parts it wants to read. Ok,
a record player can't do that part, it can only read the whole disk from
beginning to end unless you pick up the needle and move it somewhere else
on the record. But unlike a record player, a disk drive does have some-
one standing there to pick up the head and move it to another area of the
disk whenever it wants to. That's one job of the drive controller.
On a record player, there is only one "track" per side. That track is in
a spiral which reaches from the outside edge of the disk, all the way to
the center where the label is. That's not the case for a disk, because a
disk's tracks are concentric circles rather than one long spiral. Each
track is a closed circle, slightly smaller than the track outside it, and
slightly larger than the track inside it.
<page down> for more
Disks continued
Each track is divided into sectors. Each sector is just a small arc of
the circle. If you cut a disk up into pieces like a pie, then one piece
of the "pie" would contain one sector from each track of the disk. A
sector holds 512 bytes of data.
Now a cylinder is all the tracks of the disk that are an equal distance
from the edge. So each cylinder of a floppy disk has only two tracks--
one on side one of the |nfloppy|n, and one on side two. All the other tracks
on the |nfloppy|n are some other distance from the edge.
But since a hard drive has several platters (|ndisks|n) inside it, a cylinder
on a hard drive can have lots of tracks. Track 5 of side one of platter
one, track 5 of side two of platter one, track 5 of side one of platter
two, track 5 of side two of platter two, track 5 of side one of platter
three, all these tracks are in the same cylinder of the hard drive.
Ok, those were the physical parts of a disk. Now what about the logical
parts? How does DOS use |ndisks|n? Well every disk has a directory and a
<page down> for more
Disks continued
FAT. These are the parts that are used like we use the table of contents
and the index of a book. Every file that's on the disk gets a directory
entry. Every cluster of the disk gets a |nFAT|n entry, whether there is any
file in that cluster or not. Clusters are also called Allocation Units.
What's a cluster? Well, now, that's kind of tough to explain. First of
all, it depends on the size of the disk in question, and also on the ver-
sion of DOS that was used to FORMAT the disk. Sometimes a cluster is the
same as just one sector, 512 bytes. Other times a cluster can be 1024
|nbytes|n, 2048 |nbytes|n, 4096 |nbytes|n, 8192 |nbytes|n, or 16,384 |nbytes|n. You see,
since every cluster of a disk has to have a |nFAT|n entry then if the size
of the cluster was only the same as the sector size, the |nFAT|n would have
to be awfully big to hold an entry for every cluster of the disk.
So for most |ndisks|n, DOS uses clusters that are larger than the sectors.
That way the |nFAT|n can remain at a reasonable size. But there's a problem
with that. Since there can only be one filename in each |nFAT|n entry, DOS
wastes a lot of space on hard drives. A bunch of space even gets wasted
<page down> for more
Disks continued
on floppy |ndisks|n too, but not as much, because of the smaller clusters.
If you write a 27-byte file to disk, it takes up a whole cluster of disk
space because there is only one FAT entry for each cluster, and there can
only be one file for each |nFAT|n entry. So on a |nfloppy|n disk with 512-byte
clusters, that 27-byte file causes 485 bytes worth of disk space to be
wasted! (That's called "slack space".) On most hard |ndisks|n the cluster
size is 4 sectors, or 2048 |nbytes|n, so that 27-byte file is wasting 2021
|nbytes|n of disk space! It boggles the mind, doesn't it?
If you have a hard drive that is 16M or smaller, then DOS is probably
giving you 4096-byte clusters! That 27-byte file is now wasting 4069
|nbytes|n of disk space! Even if you have a very large hard drive, if you
have it partitioned into logical drives that are smaller than 16M, you
still have that ridiculous 8-sector cluster size. You'd better get your
drive repartitioned if you can! The FDISK command can do that. The same
8-sector cluster size goes for partitions between 129M and 256M too, and
larger partitions than that get even huger cluster sizes!
<page down> for more
Disks continued
This is why sometimes when you're trying to copy 357K worth of files to
a 360K floppy, you can sometimes get a "|tdisk full|t" error message. (See
also Directory.) Now that one is really confusing unless you know this
about how DOS won't use up the end of a cluster for a new file if there
is already a file using up part of that cluster.
This is also why it's important to try to combine all your teeny tiny
batch files into one big batch file. I have one |nbatch file|n (other than
|sAUTOEXEC.BAT|s) on my entire hard drive, and it can perform 49 different
functions. Its size is 12,538 so it takes up 7 clusters or 14,336 bytes
worth of disk space. If I had it all broken down into 49 batch files,
the way most people do, it would be taking up 49 clusters or 100,352
|nbytes|n of disk space! See the section on the GOTO command to see how to
combine them like that.
What Is a |tBoo|1t Disk|t?
A |nboot|n disk is a disk that has been made bootable. This is the only kind
of disk that a computer will boot from. What makes a disk bootable? It
has to have a |nboot|n record on it, as well as having the two system files
(|sIO.SYS|s and MSDOS.SYS for MS-DOS or IBMBIO.COM and IBMDOS.COM for PC-DOS)
in the right area of the disk, and it also has to have COMMAND.COM on it.
How do you make a bootable disk? (That's also called a "system disk".)
It's really easy. You just use the |nFORMAT|n A: /S command. That command
will put all of those necessary ingredients onto the disk. Don't forget
that the FORMAT command will first remove all data from the disk.
Another way is to use the command |nSYS|n A: and then COPY the |nCOMMAND.COM|n
file to the disk. The |tSYS|t command will put the system files from the
current drive, and the |nboot|n record onto the specified disk, but not the
|nCOMMAND.COM|n file. (DOS 5.0's |nSYS|n command will do that too, though.)
It is possible to make a disk bootable after it already has some other
<page down> for more
Boo|1t Disk continued
files on it, but it's not easy. Well, if the disk used to be bootable
but the system files were corrupted in some way, then the SYS command can
probably do it. But if the disk never had the system files on it, and
there are other files on it, then the |nSYS|n command probably won't work,
because the system files have to go right at the beginning of the disk,
so if there are any other files in that spot, then |nSYS|n won't be able to
put the system files there. There are some hard drive utility packages,
such as the Norton Utilities, that can do it, by moving the other files
out of the way to make room for the system files, but the |nSYS|n command
just can't do it except in DOS 5 which is not so picky about such things.
What happens if you try to boot from a disk that has not been made |nboot|n-
able? Not a whole lot. That's the problem. You'll get an error message
like, "|sNon system disk|s replace and strike any key". And that's all that
will happen.
The only disks that can be bootable are A: and C:. Those are the only
ones that the computer will check. Your access light on drive B: will
<page down> for more
Boo|1t Disk continued
come on while booting, but that is only part of the POST. When the com-
puter gets ready to look for the system files to load them into memory,
it looks on A: and if there is a bootable disk in that drive, then it
boots from there, otherwise, it looks at C: to see if that one's |nboot|n-
able. If neither A: nor C: holds a bootable disk, then your computer
isn't going to do anything.
There are just a couple of brands and models of computer that can boot
from the B: drive if they're specially set up to do so, but those are few
and far between. If you don't have one of those, then there are only two
ways to ever |nboot|n from a disk in the B: drive.
One way is to open up the computer's case, switch the cables that run be-
tween the drive controller and the A: and B: drives, and then if you have
a 286 or higher machine, go into your CMOS setup and tell it that A: is
now B: and B: is now A:. Right, technically you're still not booting
from the B: drive, because now it's the A: drive, but you're booting
from what used to be the B: drive.
<page down> for more
Boo|1t Disk continued
The other way is with a shareware program called B-|nBOOT|n or |nBOOT|n-B (it is
listed by different names on different |sBBS|ss). Your A: drive does have to
be in working order for this to work. The program creates a special disk
for your A: drive that is not bootable, but that has some data on it that
tells the computer to go look on the B: drive for the system files. So
when the computer tries to boot from A:, it ends up going to B:.
If you have a |sfloppy|s-only system, you need to make sure you have lots of
copies of the disk you usually |nboot|n from. You never can tell when three
copies of that disk are going to go bad all at once. Keep several copies
in several different places.
If you have a hard drive and it is bootable, for heaven's sake do not
think that means you don't need to keep bootable floppies around! You
most certainly do! Hard drives die and that's all there is to it. Be-
sides, what if you're messing around trying to improve your configuration
by editing your CONFIG.SYS and/or AUTOEXEC.BAT files, and you make some
error that locks up your system? Do you think that rebooting will help
<page down> for more
Boo|1t Disk continued
you in that case? If you |nreboot|n from the same disk that has the bad con-
figuration file, you'll just lock the system up again! You need to boot
from a floppy that has no AUTOEXEC.BAT and CONFIG.SYS files, or that has
older copies of those files, from before you messed them up. (By the
way, if you did mess them up, don't feel bad! It happens to the best of
us!)
Well, as I said, the only thing that needs to be done to make a bootable
disk, is to use the |nFORMAT|n A: /S command or else the |nSYS|n A: and |nCOPY|n COM-
MAND.COM A: commands. A disk that has had this done to it will |nboot|n the
computer, but it may not make all of your peripherals work. Suppose you
have some unusual hard drive which requires a special device driver, such
as DMDRVR.BIN, in the |nCONFIG.SYS|n file to make the drive recognizable to
DOS? You'll be able to |nboot|n from a disk with no |nCONFIG.SYS|n file on it,
but you won't be able to use your hard drive in that case.
You really need to know what every single thing in your |nAUTOEXEC.BAT|n and
|nCONFIG.SYS|n files does, so that you'll know which ones it is absolutely
<page down> for more
Boo|1t Disk continued
necessary for your |nboot|n disk to have on it. There are times when you
will want to boot up with the fewest possible number of commands in your
AUTOEXEC.BAT and CONFIG.SYS files, to save RAM, so you need to know what
the absolutely necessary commands for your system are. Most people can
|nboot|n up perfectly well from a disk without any |nAUTOEXEC.BAT|n or |nCONFIG.SYS|n
files, but if your system has some special configuration, you need to
know about it. So if there is some command in your |nCONFIG.SYS|n or AUTO-
EXEC.BAT file that you can't find mentioned anywhere here or in any other
DOS manual you have, or in any of the papers that came with your system,
then you need to call the dealer from whom you purchased your computer
and ask him about them.
If you have any commands in your |nAUTOEXEC.BAT|n or |nCONFIG.SYS|n files that
really have to be executed in order for your system to work properly,
then besides creating an |nAUTOEXEC.BAT|n or |nCONFIG.SYS|n file that contains
that command and putting it on your |nboot|n disk, you also need to make
sure the command file for that command is on the |nboot|n disk too. You
might be tempted to put the command into the file like this:
<page down> for more
Boo|1t Disk continued
C:\UTIL\COMMAND
but what if your hard drive seems to have lost all its data? Your system
won't be able to access the command file on the C: drive. Make sure you
copy the command file to the |nboot|n disk and change the line in AUTOEXEC
.BAT to A:\COMMAND. Do that for every single external command (that is,
commands that are not part of |sCOMMAND.COM|s) that has to be listed in the
AUTOEXEC.BAT and CONFIG.SYS files on the bootable floppy.
Did you ever wonder how on earth you would RESTORE your BACKUP disks if
your hard drive died and you couldn't access the |nRESTORE|n command that's
in your C:\DOS |sdirectory|s? Well you'd better put a copy of your |nRESTORE|n
.COM file onto your bootable |nfloppy|n disk right now, don't you think?
So, you should have a few different copies of each type of bootable flop-
py that you make, and you should make several different kinds. One that
has no |nCONFIG.SYS|n or |nAUTOEXEC.BAT|n (or if you need some special device
driver to make your hard drive accessible, put the one-line |nCONFIG.SYS|n
file onto the |nfloppy|n too) and another kind that will boot your system
<page down> for more
Boo|1t Disk continued
up just the way you always have it set up. Put the same CONFIG.SYS and
AUTOEXEC.BAT files you have on your hard drive, onto the floppy, and make
all the changes necessary to make DOS able to find the command files on
the |nfloppy|n instead of the hard drive. By that I mean change the commands
from C:\DOS\COMMAND to A:\COMMAND and then of course copy all the command
files to the |nfloppy|n also. And whatever command you use to restore your
|sBACKUP|ss, that command file must also be there. Label those floppies like
"Clean |nBoot|n" (for the one with no |nAUTOEXEC.BAT|n and |nCONFIG.SYS|n files) and
"Full |nBoot|n" (for the one with your regular configuration files) and you
are all set for any hard drive emergency.
If you have DOS version 4, no earlier version, no later version, just 4,
and if you have a hard drive partition larger than 32 mega|sbytes|s, then
there is one more file you need to have on your |nboot|n disk! |nSHARE|n.EXE!
You absolutely and definitely and always must have that file in the same
directory with COMMAND.COM, every time you boot up, so that SHARE will
get loaded into memory, if you have version 4 and a hard drive partition
larger than 32 megs! This is true for any disk you |nboot|n from, whether it
be a hard disk or |nfloppy|n disk.
What Are |tExecutable|t Files?
An |nexecutable|n file actually means any file with the extension .EXE, but
in general, it means any file that the computer can execute as a command.
There are two |nexecutable|n extensions other than .EXE, and they are .COM
and .BAT. A file with the .BAT extension is a batch file, and a file
with the .COM extension is a command file. There's another misleading
term, because generally any .EXE, .COM, or .BAT file is a command.
Files that do not have one of these three extensions cannot be executed.
They can only be used as parameters to some other command. For example,
.|nSYS|n files are |sdevice driver|ss which are used as |nparameters|n to the DEVIC|1E
command in the CONFIG.SYS file. .WK1 files are spreadsheets, .DBF files
are data bases, .DOC files are word processor documents, .BAS files are
program files in the BASIC language that can only be read by the BASIC,
BASICA, GWBASIC, or QBASIC interpreters. These are just a few of the
most common non-|nexecutable|n file extensions.
When executing a command, it is not necessary to type the command file's
<page down> for more
Executable continued
extension, just the filename. First DOS looks at the copy of COMMAND.COM
in memory to see if there is an internal command with that name. If so,
DOS will execute the command. If not, DOS will look in the current dir-
ectory for a file with that name and the extension .COM. If not found,
DOS will look for a file with that name and an .EXE extension, and if not
found, a .BAT extension. If none of those are found in the |ncurrent|n dir-
ectory, then DOS will search for those same filenames in each directory
listed on the PATH statement in the environment. If no |nexecutable|n file
with that name is found in any of these places, you'll see the famous
"|sBad command or filename|s" message.
However, if the full file specification (pathname) to the command is in-
cluded on the command line, the only place DOS will search for a .COM,
.EXE, or .BAT file with that name, is in that specified |ndirectory|n! DOS
won't even execute an internal command if one exists by that name, if the
|ndirectory|n is specified on the command line. So if you should for some
reason need to have a command file named |nCLS|n.EXE, it is possible to have
that file executed even though DOS searches the internal command table
<page down> for more
Executable continued
before searching any directories. You just need to specify the path to
the |nCLS|n.EXE file on the command line, or else if the |nCLS|n.EXE is in the
current directory, use the shortcut .\CLS. (See also ". and ..".) That
will execute the CLS command file rather than the |nCLS|n internal command.
If you have a file named HELLO.EXE and a file named HELLO.COM, or if you
have two different HELLO.COM files in two different directories, the one
that's closest to the beginning of the |nPATH|n variable is always the one
that will get executed, unless you're in the same |ndirectory|n with the
other one, or you specify the pathname on the command line.
Now here's something interesting that I recently found out. Every single
DOS book that I've ever read which has brought up this subject has said
the following: If there is a .COM file, an .EXE file, and a .BAT file
with the same first name, in the same |ndirectory|n, then there is no way
the .EXE or .BAT files will ever be executed, not even if you enter the
command as FILE.EXE or FILE.BAT, because DOS will just ignore the exten-
sion of the file and look for a command in the normal order: internal,
<page down> for more
Executable continued
then .COM, then .EXE, and then .BAT.
Well that was true in earlier versions of DOS, but it is not true any
more, and the DOS manual authors just haven't figured it out yet. I just
copied |nCHKDSK|n.COM and |nGWBASIC|n.EXE to an empty directory, renamed them to
TEST.COM and TEST.EXE, and created a TEST.BAT file that just said, "|nECHO|n
It works!" Now what I had was three different commands that all had the
first name of TEST. So I entered the command TEST and what got executed
was CHKDSK which had been renamed to TEST.COM. That's just what should
have happened.
Now according to all the DOS books, when I entered TEST.EXE as a command,
I should have gotten a |nCHKDSK|n report once again. Nope. I got GWBASIC.
Then when I entered TEST.BAT, I got "It works!"
This works for me with MS-DOS versions 4.01 and 5.0, but not with 3.2 or
3.3. But even the books that say they are updated for version 4.01 are
still saying it can't be done. This just goes to show that you can't al-
<page down> for more
Executable continued
ways be sure of anything when it comes to computers. Just because some-
thing was true in 1983 doesn't mean it's still true in 1991, even if all
the DOS books are still saying it!
As a matter of fact, remember what I said about executing an .EXE file
with the same first name as an internal command, like |nCLS|n.EXE? All the
books also say that is impossible, unless you patch your COMMAND.COM file
to change the name of the internal CLS command. But it's not true. You
don't have to patch |nCOMMAND.COM|n to execute a |nCLS|n.EXE file. You just have
to specify the |spath|sname of the file on the command line, like I said. I
just tested it on MS-DOS versions 3.2, 4.01, and 5.0 to make sure before
I said it. No problem.
Books are not always right! (Now doesn't it make you feel good, to know
that?) These things were true for so long, in all the earlier versions
of DOS, that everyone, even the authors of the DOS books, just accepts
them as gospel, without even testing to find out whether they're still
true or not.
<page down> for more
Executable continued
Ready for some more confusion? |nExecutable|n files can be called commands,
utilities, programs, or applications! There are some vague differences
between these terms, but they're basically interchangeable, more or less.
Internal commands, those that are inside the COMMAND.COM file, are defin-
itely called commands. The DOS commands that require |nexecutable|n files
can be called external commands, or DOS utilities, or DOS programs. Ex-
ecutable files that don't come from DOS can be called programs, utilit-
ies, or applications. A utility almost always refers to some command
that performs a very specific function, and that does not require any
overlay or support files. A program can mean either a utility or an app-
lication. And an application is usually a great big program that should
have a whole directory all to itself, that has a whole bunch of overlays
and support files, that is used to do your work, not just for things that
are only related to the computer itself. Examples of applications are
word processors, database managers, spreadsheets, desktop publishers, ac-
counting or payroll programs, things like that. But you can't run any of
these without an |nexecutable|n file, with the .COM, .EXE, or .BAT extension.
What Are |tParameters|t?
|nParameters|n are anything that comes after the command on the command line.
They tell DOS what you want to do with the command. Take, for instance,
the COPY command. You can't just tell DOS to "|nCOPY|n". You have to say
what you want to copy and where you want it copied to. So you might give
a command like |nCOPY|n A:FILE.TXT B:, which tells DOS to copy the file named
FILE.TXT which is on the A: drive, over to the B: drive. In this case,
"A:FILE.TXT" is the parameter that tells DOS the source for the |nCOPY|n com-
mand, and "B:" is the parameter that tells the target.
There is another type of parameter called a "switch". The /P in the com-
mand |nDIR|n /P is a switch that tells DOS to "pause" after 23 lines of the
output of the DIR command, so that you have time to see what it says, and
then you strike any key to make the display continue on with the next 23
lines.
DOS always uses "/" as the switch character, but some programs such as
the compression utility PKZIP, use "-" as in PKZIP -a FILE *.*. A switch
<page down> for more
Parameters continued
is just a parameter that tells the program to "do its thing" in a slight-
ly different way than normal.
The first "word" that is typed on the command line after the name of the
command is parameter number one, and the second "word" is parameter two,
etc. By "word" I mean something that is surrounded by spaces. So even
though you wouldn't normally think of "B:" as being a "word", in this
case it is since in the command |nCOPY|n A:FILE.TXT B: it is surrounded by
spaces. So it is parameter number two.
|tReplaceable|t |nparameters|n are very useful in batch files. What this term
means is a little symbol in a batch file that looks like %1 or %2 and it
is "replaced" by whatever you happened to type as parameter number one or
number two on the command line. An example would be the best definition.
Suppose you create a |nbatch file|n called AB.BAT that looks like this:
@ECHO OFF
|nCOPY|n A:%1 B:
<page down> for more
Parameters continued
Now if you were to type this command on the command line:
AB FILE.TXT
Then when DOS is processing that command, it sees the %1 symbol inside
the batch file and looks back on the command line to see what you had
typed as the first "word" after the command AB, and it sees FILE.TXT, so
it puts FILE.TXT there where the |nbatch file|n says %1, and this is the com-
mand that DOS executes:
|nCOPY|n A:FILE.TXT B:
Now suppose the next time you run that AB.BAT file, you use this command
instead:
AB HELLO.TXT
This time when DOS gets to the line that has the %1 symbol, and looks on
the command line and sees HELLO.TXT as the first parameter, then this is
the command that gets executed:
|nCOPY|n A:HELLO.TXT B:
Now you can see that a file like AB.BAT is not going to save you all that
much typing, but how about a command like |nPROMPT|n $e[1;32;40m. That's the
<page down> for more
Parameters continued
command you want to use to change your DOS colors to green-on-black. Not
exactly an easy-to-remember command. You can create a batch file that
will remember that command for you, like this COLOR.BAT:
@PROMPT $e[1;3%1;4%2m
(blank line goes here)
@ECHO OFF
|nPROMPT|n $P$G
Now if you were to type COLOR 2 0 on the command line, DOS would put the
2 in place of the %1, and 0 in place of the %2, and that same $e[1;32;40m
parameter for the PROMPT command would be used, without your memorizing
that complicated syntax. (The 1; means for ANSI to use bold text.)
If you got bored with green-on-black, you could just type COLOR 7 4 and
DOS would put the 7 where the %1 is, and 4 where the %2 is, and this time
you'd get white-on-blue. (See the subject ANSI.SYS for the color codes
and further information about how to change your DOS screen colors.)
You can use replaceable |nparameters|n to take the place of any part of a
<page down> for more
Parameters continued
command, even the command itself. Suppose you do a lot of changes on
your AUTOEXEC.BAT file, and you're tired of typing that filename. You
could have a batch file called AEB.BAT that looks like this:
@ECHO OFF
%1 |nAUTOEXEC.BAT|n %2
Now if you typed AEB |nTYPE|n, then the command |nTYPE|n |nAUTOEXEC.BAT|n would be
executed, or if you typed AEB |nEDLIN|n, then |nEDLIN|n |nAUTOEXEC.BAT|n would be
executed, because if there is no third word typed on the command line,
then %2 equals nothing, so having that %2 sitting there won't cause any
trouble. If you typed the command AEB |nCOPY|n B:, then the command |nCOPY|n
|nAUTOEXEC.BAT|n B: would be executed, and you'd have a |nbackup|n copy of your
file, for in case the copy on your hard drive gets damaged in some way.
Replaceable |nparameters|n are one of my favorite toys in DOS. There are a
zillion things you can use them for. The parameter %0 always stands for
the name of the |nbatch file|n that contains the %0 symbol, since the name of
the |nbatch file|n is the first "word" on the command line, and %0 is the
first |nreplaceable|n parameter. But other than that, you can use the other
|nreplaceable|n |nparameters|n, %1 through %9, for anything your heart desires.
What Is a |tRAMdisk|t?
The way to get one of these is just to load the |TRAMDRIVE.SYS|T (for MS-DOS)
or |TVDISK.SYS|T (for PC-DOS) file as a device driver in your CONFIG.SYS file
and then reboot. Well, now that you have a |nRAMdisk|n, what on earth is it?
A |nRAMdisk|n is a chunk of memory that has been made to act like a floppy
disk drive, only a really fast |nfloppy|n disk drive! Because it's only a
chunk of RAM instead of a mechanical disk drive, the access time is just
the same incredibly low number as the access time for your |nRAM|n. Other
than that, you can use it just exactly the way you'd use a disk. A |nRAM|n-
disk is also known as a |tVirtual Disk|t.
The only thing you have to remember, though, is that the |nRAMdisk|n still is
made of |nRAM|n, even if it is acting like a disk drive, so if the power goes
out, everything that was on the |nRAMdisk|n is gone forever! You've got to
remember that anything that's on the |nRAMdisk|n that gets changed, edited,
or updated, has to be saved to disk before the |npower|n is shut off, or be-
fore some lightning shuts the |npower|n off for you, or before you |nreboot|n!
<page down> for more
RAMdisk continued
It's best to use a |nRAMdisk|n only for files that don't get changed, such as
your favorite utilities and DOS command files. If your hard drive does
not have an access time under 20ms, then you'll be absolutely amazed at
how much faster a batch file works if you run it from a |nRAMdisk|n instead
of from the hard drive. Just put your |nRAMdisk|n at the very beginning of
the PATH command in your AUTOEXEC.BAT, so that DOS will look there first
for all your commands. If you don't do that, then DOS will find the com-
mand file on your hard drive first, and run it from there, so it won't be
doing you any good to put the files onto the |nRAMdisk|n.
How do you get all your favorite command files, utilities, and batch
files onto the |nRAMdisk|n? You just use COPY commands in your |nAUTOEXEC.BAT|n
file, like this, assuming your |nRAMdisk|n is drive letter F:
|nCOPY|n C:\DOS\CHKDSK.COM F: > |nNUL|n
|nCOPY|n C:\DOS\FORMAT.COM F: > |nNUL|n
|nCOPY|n C:\DOS\FIND.EXE F: > |nNUL|n
|nCOPY|n C:\BELFRY\MENU.BAT F: > |nNUL|n
The reason for the " > |nNUL|n" at the end of each line is because the output
<page down> for more
RAMdisk continued
of each COPY command is going to be a "1 file(s) copied" message, and you
don't want to be seeing that every time you boot your computer. NUL is a
special imaginary device that DOS uses. It basically means, "nowhere".
(See also Redirection.)
Another solution for getting rid of those "1 file(s) copied" messages, if
you have a whole lot of files to copy to the |nRAMdisk|n, and if you're very
careful and read every single word of this paragraph, is to leave off the
" > |nNUL|n" at the end of each of those lines, put the command |nCTTY|n |nNUL|n on
the line of the batch file just before the |nCOPY|n commands start, and put
the command |nCTTY|n |nCON|n on the line right after the last |nCOPY|n command. If
you forget your |nCTTY|n |nCON|n command there, then you'll be in big trouble.
No output will ever go to the screen, and worse yet, no input will be
accepted from the keyboard. Because what |nCTTY|n |nNUL|n does, is to redirect
all the input and output to the |nNUL|n device, until such time as a |nCTTY|n |nCON|n
command is given, which redirects everything back to the normal device
that gets used for standard input and output--your |sCON|ssole, or monitor-
and-keyboard. (See the chapter on the CTTY command.)
<page down> for more
RAMdisk continued
A |nRAMdisk|n just gets the next higher letter, after all the drive letters
your system already has. If you already have an E: drive, your |nRAMdisk|n
will get the letter F:. Don't forget that the default LASTDRIVE is E:,
so if your |nRAMdisk|n is going to give you a higher letter than that, you
need to raise your |nLASTDRIVE|n by putting a statement like LASTDRIVE=F into
your CONFIG.SYS file. Otherwise DOS won't be able to recognize what you
mean when you type F: to refer to your |nRAMdisk|n.
Another type of file that it's really good to put on a |nRAMdisk|n, is temp
files. These are temporary files that get created by some applications
and then deleted by the same application when the app no longer needs it.
If the instruction manual for the app says that you can tell it where to
put its temp files, then tell it to put them on a |nRAMdisk|n. That will
make your app run a lot faster than it would if it were using the hard
drive instead of the |nRAMdisk|n, for its temp files.
Don't worry about the fact that the |nRAMdisk|n will lose all its data if you
have a power failure. Because even if the temp files were on the hard
<page down> for more
RAMdisk continued
drive, if the power went out the application would have lost its place in
the temp file anyway, and the temp file would now be useless to the app
and you would just have to delete it to free up the space it was taking
up on your disk. So you're not losing anything by having the temp files
on the |nRAMdisk|n if the |npower|n goes out.
If you have any extended memory, then a |nRAMdisk|n is one of the best uses
for it! The RAMDRIVE.SYS and VDISK.SYS |sdevice driver|ss contain their own
|nextended|n |nmemory|n managers, so you don't need any special software in order
for your |nRAMdisk|n to be able to use your |nextended|n |nmemory|n. Just add the /E
switch to the end of that DEVIC|1E command in CONFIG.SYS, and your |nRAMdisk|n
will be placed into |nextended|n |nmemory|n instead of taking up space in your
conventional |nmemory|n. (With DOS 5 you have to load HIMEM.SYS first.)
If you have a recent DOS version, you can also place your |nRAMdisk|n into
expanded |nmemory|n, if you don't have any |nextended|n |nmemory|n (|nextended|n is more
efficient), by using the /X or /A switch. Which one is allowed, if ei-
ther, depends on the DOS version that you have.
<page down> for more
RAMdisk continued
Here is the complete syntax for the RAMDRIVE.SYS and VDISK.SYS drivers:
DEVICE=D:\DIR\FILENAME.|nSYS|n AAAA BBB CC /E:D /X:D /A:D
where AAAA is the size of the |nRAMdisk|n in Kilo|sbytes|s, and the default is
64. The BBB parameter stands for the sector size you want the |nRAMdisk|n
to have. The choices are 128, 256, and 512, with 128 being the |ndefault|n,
except for DOS version 5, where the |ndefault|n is 512. If you are going to
be putting a lot of very small files onto the |nRAMdisk|n you will want to
use 128, but if you will have only large files and you just barely have
enough room on the |nRAMdisk|n for the files you want to put there, then use
the 512 byte sector size because with the larger sectors, DOS can give a
smaller amount of space to the FAT. The CC parameter means the number of
root directory entries you'll need. The |ndefault|n is 64, so if you're hard
up for space on your |nRAMdisk|n, and you're only going to need a few files
at a time, give a smaller number so that less |nRAMdisk|n space will be occu-
pied by the |ndirectory|n. Or if you use a small number, then use one of
those |ndirectory|n entries for a subdirectory, and put all the files there.
That way it doesn't matter how many files you have on the |nRAMdisk|n. The
/E and /X and /A switches are used if you want the |nRAMdisk|n to be placed
<page down> for more
RAMdisk continued
into extended or expanded memory. Of course you can only use one of them
at a time. The :D parameter that is connected to the /E or /X or /A is
optional, and it tells DOS how many sectors of data to transfer to and
from the |nRAMdisk|n at a time. The D can be from 1 to 8, with 8 as the de-
fault, and you can pretty much ignore that parameter, just leave it at
the default, unless the manual for one of your applications tells you
otherwise.
Just don't forget if you ever decide to remove the |nRAMdisk|n line from your
CONFIG.SYS file, that all of the applications you may have configured to
use the |nRAMdisk|n for their temporary files, will still be looking for the
|nRAMdisk|n, and that could cause you big problems. So remember everything
that you've told to use the |nRAMdisk|n, including |sbatch file|ss, so in case
you stop using the |nRAMdisk|n you can direct everything back to your hard
drive again.
You can use as many RAMdisks as you want at the same time, if you have
enough |nmemory|n, by repeating the DEVIC|1E command that creates the RAMdisks.
Each |nRAMdisk|n will get the next higher drive letter than the previous one.
What Is |tShelling Out|t?
Many applications have a menu choice where you can get to a DOS prompt
without actually exiting from the application. Then you can do whatever
it was that you wanted to do in DOS, and then when you type |nEXIT|n you get
taken right back to the point where you had been inside your application
before you went to the DOS |nprompt|n. This is called "shelling out" to DOS.
The reason it's called that, is because COMMAND.COM, your command inter-
preter, is also called a command shell. When you shell out to DOS from
within another application, what the application does is load a secondary
copy of |nCOMMAND.COM|n into memory, and you do your work in that secondary
shell.
The |TEXIT|T command causes the secondary command shell to drop out of mem-
ory, and you find yourself right back where you were before the secondary
shell had been loaded on top of what you had been doing.
If you forget that you're in a secondary command processor, and you don't
<page down> for more
Shelling Out continued
use the EXIT command to get back into the application, and exit the app,
before you turn the computer off for the day, then not only will your
work that you'd been doing inside the application not get saved to disk,
but also you could end up with all sorts of strange files on your disk.
Many applications make temporary working files on the disk, to keep track
of things that they're doing that don't all fit in memory. When you exit
the application, it automatically cleans up after itself and deletes the
temp files that it had been using. If you don't exit the application
properly before turning off the computer, the application never gets the
chance to delete those files.
Also, many applications create yet another temp file on the disk, when
you shell out to DOS, to remind itself how to get back to where it was,
whenever you're done in DOS and type the |nEXIT|n command. When you do type
|nEXIT|n and go back to the application, the app uses that temp file to find
its way back, and then it deletes that temp file. So if you don't ever
use the |nEXIT|n command to get back to the app, then there's another temp
<page down> for more
Shelling Out continued
file that stays on your disk.
An awful lot of beginners (and non-beginners too) have this problem with
DOS version 4's DOSSHELL. There are two ways you can get a DOS prompt
from within the |nDOSSHELL|n. One way, when it displays the DOS |nprompt|n, it
also says across the top of the screen, "When ready to return to the DOS
Shell, type |nEXIT|n then press enter". If you see that banner across your
screen, then you know that you have not exited the |nDOSSHELL|n, you have
only shelled out. If you turn off the computer at that point, you will
end up with those funky filenames like 10370F37 (yes, that's a filename)
on your disk. You need to type EXIT to get back to the |nDOSSHELL|n, exit
from the |nDOSSHELL|n in the proper manner, and then turn off the computer.
You know that you never want to turn off the computer unless you're at
the DOS |nprompt|n, but you also need to make sure you're at the |nprompt|n for
the primary command shell, not a secondary one. That way you won't get
all those funky numbered filenames all the time, only once in a while
when your computer locks up and you have no choice but to reboot while
<page down> for more
Shelling Out continued
you're in an application. But that can't be helped; it just happens.
So how do you make sure you're always in the primary command processor,
instead of a secondary one, before you turn off the computer? Just type
|nEXIT|n and hit <Enter>. If you had been in a secondary shell, that command
will take you back to whatever you had been doing in the primary shell
before you shelled out to a secondary one. But if you're already in the
primary shell, then the EXIT command won't do a single thing, as long as
you have followed one rule in your CONFIG.SYS file: If you have a |nSHELL|n
statement in that file, it absolutely must have a /P switch at the end of
it. If you don't have a |nSHELL|n statement, that's fine, but if you do, it
has to have the /P switch.
So if you type |nEXIT|n at the DOS prompt before you turn off your computer,
it will take you back into whatever application you were running so that
you can exit it properly, or else if you were in the primary shell, the
command will have no effect and you'll know that you can turn off your
computer without leaving any of those funky numbered files laying around.
<page down> for more
Shelling Out continued
What if you already have some of those funky numbered files on your disk?
Well, they're probably just temp files from your not properly exiting
some application, in which case there's no reason not to delete them.
They're just taking up space on your disk for nothing. But just in case
they are something that one of your applications requires, copy them to a
floppy for safe-keeping, and then after you see that your app still runs
just fine, then you can delete them from the |nfloppy|n. If your app doesn't
run anymore, then you know that one or more of those files was something
necessary, instead of just a temp file. So copy them back one by one, to
figure out which one it is that your app needs, leave that one on your
disk and just delete the others.
If you have an application from which you like to shell out a lot, and
you run that application from a batch file, there is something you can do
to make it easy for you to remember that you're in a secondary shell
rather than the primary one. Suppose the name of this app is WORD and
the |nbatch file|n from which you run it, is WP.BAT:
<page down> for more
Shelling Out continued
@ECHO OFF
CD C:\WORD
|nPROMPT|n Shelling from WORD--Type |nEXIT|n to return$_$P$G
WORD
|nPROMPT|n $P$G
CD \
Now every time you run the WORD application by using WP.BAT, your prompt
will be changed from:
C:\WORD>
to:
Shelling from WORD--Type |nEXIT|n to return
C:\WORD>
so that you can't possibly forget that you're in a secondary shell, and
then after you exit from the WORD application, the batch file puts your
|nprompt|n back to:
C:\WORD>
before it changes back to the root directory and leaves you in DOS.
<page down> for more
Shelling Out continued
Or if you're using the DOS version 5.0 DOSSHELL, you can change the prop-
erties screen of the "Command |nPrompt|n" Main Group menu choice, to make the
command that it executes look like this:
|nPROMPT|n Type |nEXIT|n to Return to Shell$_$P$G ; |nCLS|n ; COMMAND ; |nPROMPT|n $P$G
so that whenever you use the "Command |nPrompt|n" menu option to shell out to
DOS, it will remind you that you're in a secondary shell, and it will al-
so clear the screen for you since the |nDOSSHELL|n will mess up any color you
had set up using ANSI.SYS, which the CLS command will put back to normal.
What if you have an application that offers a menu choice of |nshelling out|n
to DOS, but it never works? Well most applications use the COMSPEC vari-
able in the environment to find your copy of COMMAND.COM and load it, but
there are some poorly-written applications that don't do that. They look
in the root directory of the boo|1t disk to find a file named |nCOMMAND.COM|n
and they load that, without even looking to see what the |nCOMSPEC|n variable
has to say. If you have an application that does that, and you really do
want to be able to shell out from that app, then you will have to just
leave your |nCOMMAND.COM|n file in the |nroot|n |ndirectory|n, and adjust your SHELL
statement in CONFIG.SYS accordingly.
The |TFORMAT|T Command
What on earth is this |nFORMAT|n command that most DOS manuals expect you to
understand with very little explanation? The manuals say that it pre-
pares a disk for use by DOS. Well what does that mean? It can be visu-
alized like the lines on a parking lot. A person knows how to |npark|n a car
even when there are no lines at all. However, DOS isn't that smart. DOS
cannot even begin to think about parking a file on a disk, unless it can
see the lines on the parking lot! The |nFORMAT|n command is what paints the
lines there. That's why a disk can't be used until it's been formatted.
The only exceptions to this are the DISKCOPY command, which copies the
entire source disk, including the format, so the target disk need not be
formatted first, and some versions of BACKUP programs, which can call the
|nFORMAT|n command to format the disks during the |nBACKUP|n process.
Don't forget that if there are any files on the disk, the |nFORMAT|n command
will wipe out all the directory entries for all the files. Your files
will basically be gone. There are hard drive utility packages such as
<page down> for more
FORMAT continued
Central Point's PC Tools and Symantec's Norton Utilities that can get the
files back for you, and also in DOS version 5.0 there is an UNFORMAT com-
mand, but it's a lot easier to just not format a disk, than it is to un-
format it. Before you format any disk that's been used before, be sure
to check the directory to see if there's anything you might want to save.
Formatting |tfloppy|t disks can get kind of tricky sometimes. You need to
understand the differences among all the different types of |nfloppy|n |ndisks|n.
Right now there are only four types that are the least bit popular. They
are 360K, 720K, 1.2M, and 1.44M.
A 360K disk holds 368,640 bytes of data. (One K is equal to 1024 |nbytes|n.)
The physical size of such a disk is 5.25 inches, and the disk is enclosed
in a really flimsy plastic cover. Another name for it besides "360K" is
DSDD or 2S2D which means Double-Sided, Double-Density.
A 720K disk holds 737,280 |nbytes|n of data. This type of disk is 3.5 inches
in size, and it is enclosed in a nice hard sturdy plastic shell. It can
<page down> for more
FORMAT continued
also be referred to as a DSDD or 2S2D disk, which is the same thing that
a 360K disk can be called. So you have to watch out for what size you're
buying, as well as what density.
A 1.2M disk is a DSHD (High-Density) 5.25-inch disk. It holds 1,258,291
bytes of data, since a Megabyte is equal to 1024 X 1024 |nbytes|n. And a
1.44M disk is a DSHD 3.5-inch disk which holds 1,509,949 |nbytes|n of data.
Some manufacturers write things like "2M" on a box of 1.44M disks, or
"1M" on a box of 720Ks, but they're not giving you any more space than
the other manufacturers do! They're just trying to make you think they
are. The "2M" means the capacity of the disk before it is formatted!
When a disk is formatted it gets a |nboot|n record, a FAT, a root directory,
some sector headers, and things like that so that DOS will be able to
work with the disk. Once a "2M" disk has been formatted, it has 1.44M of
space left for data, just like any other DSHD 3.5-inch disk. Don't let
those marketing departments fool you!
<page down> for more
FORMAT continued
A HD (High Density) disk drive can read and write either HD or DD disks,
but a DD (Double Density) drive can only use DD |ndisks|n. In fact, most DD
drives can't even read a DD disk if it was formatted by a HD drive. The
way to transfer data between a HD drive and a DD drive, is by formatting
the disk that will be used, on the DD drive, then writing to it on the HD
drive. Then the DD drive will usually be able to read it.
You can format a DD disk to its DD capacity in a HD drive, but only if
you use the correct switches with the |nFORMAT|n command. Here's where it
gets complicated. If you have DOS version 4 or higher, you just say:
|nFORMAT|n A: /F:720 or |nFORMAT|n A: /F:360
to format the disk to the desired capacity. But before DOS version 4,
it was not so easy!
Under DOS version 3 you can use the command:
|nFORMAT|n A: /4
to format a 360K disk in a 1.2M drive. But that one won't work to format
a 720K disk in a 1.44M drive. For that, you have to use the command:
<page down> for more
FORMAT continued
|nFORMAT|n A: /N:9 /T:80
Of course this only works in DOS version 3.3, since before that, there
was no such thing as a 1.44M drive anyway.
Well, that wasn't really so hard after all, was it? The only hard part
is memorizing something like /N:9 /T:80. You can write a batch file that
will remember those switches for you, and name it 720K.BAT or something.
It's really a very bad idea to try to format a disk to some capacity oth-
er than what it was made for. In some cases it can be done, but even if
it seems to work, it is not reliable. The data might sit on such a disk
for a couple years if you're really lucky, but suddenly it will just dis-
appear, and of course that will happen right when you need that data the
most. So if you want to format a disk to High Density, buy a High Den-
sity disk. If you want to format a disk to Double Density, buy a Double
Density disk. Of course if you only have a Double Density drive, then
you don't have to worry about this. DD disks are the only kind that your
drive will even try to read.
<page down> for more
FORMAT continued
If you want to assign a |sVOL|sume label to the disk as soon as it's format-
ted, you include the /V switch on the command line, and when formatting
is complete, DOS will ask you what you want the label to be. With DOS
version 4, you can include the volume label on the command line, as in
/V:WHATEVER so that DOS won't ask you at the end, it will just put that
label on instead. And in version 5, DOS is going to ask you what the la-
bel should be whether you use the /V switch or not. So in version 5, the
only time you use the /V switch is when you do include the label on the
command line.
You can reformat and reuse disks as many times as you want, but there's
one thing to be careful of. If you reuse a disk you're probably going to
want to change the paper label that's on the outside of the disk. For
goodness' sake, if it's a 5.25" floppy disk, do not use a hard ballpoint
pen or a pencil or anything to write on any label that's on the disk.
Use a felt-tip pen or write on a new label and put the label on the disk
after you write on it. And don't ever put a disk in the drive if its
label is coming loose because it can get stuck and come off in the drive.
<page down> for more
FORMAT continued
It's perfectly normal to get a few bad sectors when formatting a disk.
Almost every hard drive in the world has some, and it's not that rare for
a floppy to have a few. Sometimes if you reformat the disk, the bad sec-
tors will be cleared up, sometimes not. DOS marks the bad sectors off in
the FAT as if they were already in use, so that your data won't get
stored there.
Starting with DOS version 4.0, every disk that gets formatted gets a ser-
ial number, which is a unique number that the computer picks based on the
time of the system clock. This number will be displayed whenever you use
the DIR or CHKDSK commands, and can be used by some programs which were
written to be able to use it, to make sure that the correct disk is in
the drive. Why? Well imagine that the program is storing some informa-
tion in memory and you take a disk out of the drive and put a different
one in. Well if the program doesn't notice that you changed disks, and
it writes that data from |nmemory|n to the disk, it could trash the |nFAT|n of
that disk. If the program checks the serial number first, and sees that
you changed |ndisks|n, then it won't do such a lousy rotten thing.
<page down> for more
FORMAT continued
The rest of this section is about the changes in DOS version 5.0's FOR-
MAT command, so if you don't have version 5, don't pay too much attention
to this or you might get confused about what your version of DOS is cap-
able of. Check it out to see what you're missing, though.
DOS version 5.0's new |nFORMAT|n command does a "safe" format, which means
that it does the same thing the MIRROR command does, namely it stores a
copy of the disk's FAT and root directory in a little file named |nMIRROR|n
.FIL, before it formats the disk. Then if you realize ten minutes later,
before you've written any more data to that disk, that it was the wrong
disk and you didn't mean to format that one, you can use the UNFORMAT
command to put it back the way it was right before you formatted it.
This "safe" format is what DOS will use if you don't specify the /U
switch and if you don't try to reformat a disk to a different capacity
than that at which it was originally formatted. (You don't need to have
the |nMIRROR|n.COM file available to make this work though, because the app-
licable parts of that command's code are inside the |nFORMAT|n.COM file.)
<page down> for more
FORMAT continued
The first new switch for the DOS version 5.0 |nFORMAT|n command is /Q. That
stands for quick format. The FAT and root directory are treated just
like normal, but no surface scanning is done. Normally the |nFORMAT|n com-
mand checks for bad sectors on the disk and if any are found, they are
marked as bad in the |nFAT|n so that DOS will never try to store any of your
data in those spots. But |nFORMAT|n /Q skips this step. Therefore, you
should never use this switch with a brand new disk, and you should never
use it on a disk from which you have received any read errors.
Then there is the /U switch which stands for unconditional, but it would
really make more sense to think of it as standing for unsafe. Because
this switch causes the |nFORMAT|n command to not run the MIRROR program, so a
disk that's been formatted with the /U switch can't be |sUNFORMAT|sted. The
/U switch should always be used for brand new disks, because this'll make
the process go a lot faster.
The /F switch is not new to version 5, but one of its parameters is. You
can use /F:2.88 to format a 2.88M disk if you have a new disk drive that
supports that size.
How Does |tMagnetism|t Affect |sDisks|s?
Well, |nmagnetism|n is what puts the data onto your |ndisks|n. So obviously any
magnetic field can change the data that's on a disk. They make a device
called a degausser, which is just a strong magnet, to totally and com-
pletely erase a disk. (Quite often a disk that just won't FORMAT proper-
ly can be fixed up by a magnet. It will erase all traces of any data,
or even the previous format itself, so that the disk is just as blank as
when you bought it, and now it will format properly.) If you need a de-
gausser and don't have one, a stereo speaker generally works pretty well.
Just lean your disk up against it and crank up some Judas Priest, and
your disk ought to get degaussed.
All right, so obviously you don't want to tack a disk up to the side of
your filing cabinet with a magnet, but what else do you want to watch out
for? Well your monitor is about the worst culprit. There's a tremendous
magnetic field in there, and it comes out especially strongly from the
back and the top. If you have one of those old phones that has an actual
bell-like ring, rather than one of the newer electronic beeping rings,
<page down> for more
Magnetism continued
then your phone gives a pretty decent magnetic field every time it rings.
Some people say that even the cord running from the phone to the wall,
and speaker wires, and any sort of electric wire, also give off a magnet-
ic field. I don't know if that's true or not, but, better safe than
sorry, eh?
Just about anything electrical, especially anything with a motor in it,
causes a magnetic field. Yes, that includes your printer and your fluor-
escent desk lamp. (Fluorescent lamps do some really strange things to
your monitor, too, if it's sitting too close.)
Well gosh, you say, there's electricity everywhere! How am I supposed to
keep any data on my |sdisks|s? Well, it's really not as bad as I've made it
sound. All of these things can possibly wipe the data from a disk, but
it doesn't happen that often. The disk has to be exposed to the field
for a while before anything usually happens to the data, depending on the
strength of the field. Just don't lean a disk up against the phone, or
set it on top of the printer, for more than a couple minutes. Try to
<page down> for more
Magnetism continued
keep your disks at least a foot away from all the things I've mentioned,
but you don't necessarily have to panic if you forget and lean a disk
against your electric stapler.
Also remember that a pattern of magnetic particles (your data) on a disk
will tend to fade over time. The older a disk is, the easier it would be
for a magnetic field to trash your data, because the pattern of magnetic
particles has begun to fade. That's why you ought to refresh all your
floppies every couple years by using the PC Tools PCFORMAT command with
the /R switch. (I would imagine that the Norton Utilities has a similar
feature as well; I just don't know what it's named.) This will read each
track's worth of data into memory, FORMAT that track, and then write the
data from |nmemory|n back to the floppy disk at full strength.
This also needs to be done to a hard drive every couple years (unless you
have one of the new IDE drives which must never be |nLow-Level|n Formatted).
But the |nFORMAT|n command won't do it. Because you see, in a hard disk, the
format is done in two separate steps. You could think of the |tLow-Level|t
<page down> for more
Magnetism continued
Format as putting a coat of sealant on the parking lot before the FORMAT
command paints the lines on the lot. On floppy disks, the |nFORMAT|n command
performs both of those steps, but not on a hard disk.
There are utilities such as SpinRite and one of the features of Norton
Utilities, that will do a Low-Level Format the same way the /R switch
of PCFORMAT works--it reads one track of data into memory, formats that
track, and then writes the data back to the disk. That means your data
most likely will not be lost during the |nLow-Level|n Formatting process.
In general though, a |nLow-Level|n Format will erase every speck of data from
a disk, so thoroughly that no recovery utility in the world can get it
back. So here are the steps to follow to perform a |nLow-Level|n Format:
1. BACKUP
2. |nLow-Level|n Format
How, you say? Well most hard drive controllers have the
code which performs a |nLow-Level|n Format stored in a ROM chip right there
on the controller. You can use DOS's DEBUG command to access it. The
<page down> for more
Magnetism continued
instructions and the applicable ROM memory address will be found in the
literature that came with your drive, or you can contact the dealer or
the manufacturer.
3. FDISK
4. |nFORMAT|n C: /S
5. Mark out Bad Clusters!
The FORMAT command does not always find all the unusable
clusters! Before you restore your data from your backup disks, you need
to run some disk diagnostic utility, such as the Surface Scan option of
PC Tools DISKFIX, to check the whole drive for bad clusters and mark them
as "bad" in the FAT so that DOS won't put any of your data in a bad spot.
The |nFORMAT|n command is supposed to do this for you, but it's not totally
reliable. So if you have such a utility, use it at this time!
6. RESTORE
That's all! Now you have a nice fresh hard drive with nice fresh data!
But remember, don't ever do a Low-Level Format if you have an IDE drive,
and don't ever do it without having a complete |nbackup|n! Even the non-de-
structive |nLow-Level|n Formats like SpinRite can goof up once in a while!
How Does |tPower|t Affect Your Computer?
Well, besides the obvious--that the computer doesn't run without |npower|n--
there are other things to consider. (See also Park.)
One is tied right in to the fact that the computer only runs if it has
|npower|n. All the data that's temporarily stored in RAM while the computer
is working on that data, will be lost totally and completely if you have
a sudden |npower|n outage. (See also Shelling Out for more info about things
that happen if you |sreboot|s--or if a |npower|n outage reboots for you--while
you're in the middle of an application.) So you need to save what you're
working on, to your disk, very often. That way, if the |npower|n goes out,
you only lose what you had done since you saved your work ten minutes ago
instead of losing everything you did since you saved three hours ago.
Remember that "data in |nRAM|n" includes everything that's sitting on your
RAMdisk too. So if you're working on a file from the |nRAMdisk|n, saving it
back to the |nRAMdisk|n every ten minutes won't help you if the |npower|n goes
out. You need to save your work to a real disk, either hard or floppy.
<page down> for more
Power continued
(Now isn't it just the most appropriate thing in the world, that the
electricity in my house just now flickered for about a tenth of a second,
so my computer |sreboot|sed itself. Luckily the text editor I use has this
handy <F2> key which saves the document to disk without exiting the edit-
or. I had just used that key a moment before the "|npower|n hit", so I only
lost about two sentences, which I had written since I hit the <F2> key.)
Another factor that computer users need to worry about is |nPower|n Surges.
Wouldn't it be nice if the electricity that comes out of the wall were at
a nice constant 110 volts or whatever it's supposed to be? But that's
not the case. Besides "|npower|n hits", where the voltage goes way down for
just a second, there are also Surges, where the voltage goes way up for
a second. This also can be quite damaging to computers, TVs, and other
electronic devices. Especially computers.
You can buy special |npower|n strips that act as "Surge Suppressors", for
about $15, but those don't do you very much good. They're better than
no surge protection at all, of course, but those cheap ones just don't do
<page down> for more
Power continued
a very good job! The ones in the $80 price range really do work pretty
well. There are even a couple of companies that guarantee both the Surge
Suppressor and your equipment that's plugged into it! If their Suppress-
or fails and your computer gets trashed, they will pay for all of the re-
pairs! Of course, that doesn't help you to replace all the data that was
on your hard drive. That's what frequent |sbackup|ss are for!
(The next paragraph may or may not be true. It was true a few years ago,
but I've heard in a couple places that the |npower|n supplies they're putting
into computers these days take care of this problem all by themselves. I
don't know if that's completely true or not, so I'm going to mention it.)
Ever notice how a light bulb usually burns out right when you turn on the
switch? Any time you turn on an electrical device, a sudden shock of
high voltage goes through every component in the device. Personally, I
don't want to subject my computer to that shock any more often than ab-
solutely necessary! This is part of the raging debate over whether a
body should leave his computer on all day long, or whether he should turn
<page down> for more
Power continued
it off when he's not using it. Turning it off is not a problem, but
turning it back on can have some undesirable effects.
If you live in an area that actually experiences "Winter", you know that
the potholes in the streets get really bad in the Spring, because of the
constant expansion/contraction caused by freezing/thawing. Well you know
that when your computer is running it gets awfully warm in there! And
when it's not running, it cools to room temperature. All that changing
of the temperature causes the boards and cables inside the computer's
case to work their way out of their slots and plugs. So whenever you
suspect that you have a bad video card or drive controller, the first
thing you want to check, before you spend money on a repairman, is to
open up the case and reseat all the cards and replug all the cables.
First you want to turn off the |npower|n to the computer, and unplug it from
the wall. Now open up the case, and before you touch anything inside,
plug the |npower|n cord back in so that the computer will be grounded. Now
touch the |npower|n supply (the big silver metal box usually in the right
<page down> for more
Power continued
rear corner) which, since the computer is plugged in, will drain off any
static charge that your body might be carrying. Because static electric-
ity can ruin a RAM chip just like that! (Static can do a lot of damage
to lots of parts of your computer, and your floppy disks too.) Touch the
|npower|n supply very frequently while you're working, especially if you're
standing on carpet! Just push down on all your expansion cards, and un-
plug and replug all the cables. Stay away from the motherboard, which is
a big flat thing laying down in the bottom of the computer. Put the cov-
er back on and |npower|n up the computer, and it's very likely that your
hardware problem has vanished!
What about lightning? You want to talk about some |npower|n? There's more
electricity in a bolt of lightning than you will see anywhere else, all
week put together! If lightning strikes your neighborhood and your com-
puter is plugged into the wall via either the |npower|n cord, or the phone
cord leading to your modem, there's a good chance that your whole compu-
ter will be fried! If lightning strikes the house next door, your com-
puter is a goner for sure. If you hear thunder in the distance, finish
<page down> for more
Power continued
up what you're doing, shut the computer off, and unplug the |npower|n cord
and the modem's phone line just as quick as you can. If you live in an
area where there are a lot of thunderstorms in the summer, unplug the
|npower|n cord and the modem line every night when you go to bed, and every
time you leave the house. If you go on vacation, unplug even if your
area doesn't get that many thunderstorms!
Lightning and |npower|n surges are just about the only reasons I can think of
for turning the computer off whenever you're not using it. I leave mine
on from the time I get up, until the time I go to bed, except for when I
leave the house. There are corporations that have a couple hundred com-
puters and they stay on twenty-four hours a day seven days a week, except
maybe Christmas vacation, and those computers do just fine. Some people
turn their computers off and on several times a day, and they seem to do
just fine too. I've got a feeling the reasons for turning it off are
just about equal to the reasons for leaving it on, and that it's just a
matter of personal preference. Read everything in this section, get a
few more opinions, and then use your best judgement as to how you want to
<page down> for more
Power continued
do it. It probably doesn't make much of a difference.
Oh, yeah, I thought of another reason in favor of turning it off. The
whole time the computer is running, the fan is pulling air from your room
into the computer and across the components to keep things cool in there.
Well if your air has cigarette smoke or cat hair or dust floating around
in it, and you leave the computer on all the time, then those foreign
bodies in your air are going into the computer even more often than is
necessary. Then again, I've got a very furry cat and I smoke two packs a
day, and I've never had any troubles with my computers.
Regardless of whether you decide to turn yours off or leave it on when
you're going to be away for a long time, you have to do something about
the monitor. As long as the same image sits unchanging on the screen,
you're risking what they call "burn-in". (Burning in has another defin-
ition too, and that is leaving the computer turned on for at least two
solid days when it's first been put together, because generally computer
components are most likely to fail very early in their life. If the com-
<page down> for more
Power continued
puter is left running and working on something like a battery of diagnos-
tic tests, for two whole days and nothing fails, that probably means the
computer is going to be fine for a long time to come. Your dealer should
have done this for you before he let you have the machine.) In this case
"burn-in" means that the same image being left on the screen for an ex-
tended period of time can cause that image to burn permanently into the
screen. You don't want this to happen, so whenever you walk away from
the computer for a minute, turn the brightness and contrast knobs all the
way down. If they're in the back and really hard to reach, then switch
off the |npower|n on the monitor. It's not really good for the monitor to be
turning it on and off all the time, but it's better than burn-in. There
is a much better solution to this, though. There's a type of TSR called
a screen-blanker or screen-saver, which monitors your keyboard and every
time you don't hit any keys for a specified number of minutes, the |nTSR|n
will just remove everything from the screen or, in some cases, put up a
pretty pattern of constantly-changing graphics, and then when you want
your old screen back, you just hit any key and poof! The screen you were
working on before the screen-saver kicked in, is right there. There are
hundreds of shareware screen-savers available from your local BBS.
The |TXCOPY|T Command
Oh, what a useful command, if you have DOS version 3.2 or higher! The
COPY command reads one file from the source, writes it to the target,
goes back to the source to read the next file, etc. But |nXCOPY|n reads as
many of the source files as can fit into the available RAM, writes them
to the target, and then goes back to get a bunch more from the source.
It's so much faster! And it also has a whole bunch of switches that can
make it do all sorts of things! (It can't copy Hidden files, though.)
Well, here is |nXCOPY|n's syntax:
|nXCOPY|n D:\DIR\FILENAME.EXT D:\DIR\ /A /D:DATE /E /M /P /S /V /W
where D:\DIR\FILENAME.EXT is the files you want to copy, and it can use
wildcards of course, or if you want to copy all the files in that direc-
tory, you can just say D:\DIR instead. The second D:\DIR\ is the drive
and directory you want to copy the files to. If you leave that part out,
|nXCOPY|n will bring the source files to the current |ndirectory|n. If D:\DIR\
doesn't exist, |nXCOPY|n will create it, but if you don't include that last
backslash, |nXCOPY|n will ask you whether you want D:\DIR to be a file or a
<page down> for more
XCOPY continued
directory. If you're copying more than one file, then of course you want
D:\DIR to be a |ndirectory|n, rather than a file.
The /A switch tells |nXCOPY|n to only copy the files that have their Archive
attributes turned on. That means files that have been changed or created
since the last time a program that resets the A attribute was used. (All
BACKUP programs reset the A attribute when they handle files.) But when
the /A switch is used, |nXCOPY|n leaves that A attribute turned on when it's
done.
The /D:DATE switch tells |nXCOPY|n to only copy the files that were last up-
dated on or after DATE. For example |nXCOPY|n C:\SIMPLY A:\ /D:07-05-91 will
only copy files whose date in the |ndirectory|n listing is 7/5/91 or later.
The /E switch can only be used if the /S switch is used too, and it tells
|nXCOPY|n to create directories on the target disk just as they exist on the
source disk, even if there are no files in that |ndirectory|n on the source.
<page down> for more
XCOPY continued
The /M switch is just like that /A switch, except that when the /M is
used, |nXCOPY|n turns off the A attribute for each file it copies! Oh, how
useful this is! Of course it's great for an alternative to the BACKUP
command, but it has an even better use. Have you ever tried to copy a
bunch of files to floppy, and there wasn't enough room on the |nfloppy|n for
all the files, and the COPY or |nXCOPY|n command just stopped dead in its
tracks and said "Insufficient disk space"? Then you had to see what
files did make it to the |nfloppy|n, and copy each of the rest of the files
separately. Didn't you just hate that? Well you never have to do it
again. Here's what you want to do. First, look and see which files al-
ready have their A attribute set. You need to know this, so that you can
put them back the same way when this is done, so that your |nbackup|n program
will know which files need to be backed up. The command |nATTRIB|n *.* /S
will show you all the files in the current directory and its subdirector-
ies, and there will be an A to the left of each file that has an A at-
tribute. (If you have DOS version 5, then the DIR command with the /A
switch will do this for you even easier. Just use |nDIR|n /AA to see the
files that have an A, or do |nDIR|n /A-A to see the ones that don't.) Now
<page down> for more
XCOPY continued
keep track of the results of that command, for later. Step two is to
give an A attribute to all the files you want to copy, and take A attrib-
utes away from files that you don't want to copy. Use the ATTRIB command
to do that. Step three is to issue the |nXCOPY|n command, with the /M switch
(and /S and /E if you want) and |nXCOPY|n will copy all the files that have A
attributes, and reset the A attribute for each file that it copies. Now
when the disk is full, |nXCOPY|n will stop and say "Insufficient disk space",
but that's ok. Just put in a fresh disk and use the <F3> key to issue
the exact same |nXCOPY|n command again. Now since the /M switch turned off
the A attribute for each file that it already copied, |nXCOPY|n will start
copying right where it left off. When |nXCOPY|n gives you back your DOS
prompt without saying "Insufficient disk space", then all your files are
copied. Now use the |nATTRIB|n command to put the A |nattributes|n back the way
they were, and you're all set. This is not nearly as complicated as it
sounds from the description, so once you've tried it, next time you'll
probably remember the whole process without even reading this again.
The /P switch tells |nXCOPY|n to stop and ask you, before copying each file.
<page down> for more
XCOPY continued
That's good for in case you want to copy almost all the files in a direc-
tory, or almost all the files that match a particular wildcard specifica-
tion, or almost all the files that have a later date than the DATE in the
/D switch, or almost all of whatever.
The /S switch makes |nXCOPY|n copy all the files in the specified directory,
and all the files in all of its subdirectories. If the subdirectories by
those names don't already exist as branches off the specified target dir-
ectory, then |nXCOPY|n will create them, as long as there are files inside
them. If you want |nXCOPY|n to create subdirectories that don't have any
files in them, then you want to use the /E switch along with the /S.
The /V switch makes |nXCOPY|n do the same worthless sort of verification that
the VERIFY command does. Don't bother. Use the COMP or FC command after
you make the copy, instead of using this switch.
And the /W switch makes |nXCOPY|n wait for a keystroke before it starts copy-
ing. This is good if your |nXCOPY|n.EXE file is on a floppy disk that is not
<page down> for more
XCOPY continued
the same disk you want to copy files from. You put the |nXCOPY|n.EXE disk in
the drive and issue the command including the /W switch, DOS reads the
|nXCOPY|n command code into memory, and then you can take out the |nXCOPY|n.EXE
disk and put in the source disk instead, and then |nXCOPY|n will start read-
ing the files you want to copy.
Of course not even the wonderful |nXCOPY|n command can do anything with a
file that's too big to fit all on one floppy disk. For that you need the
BACKUP command, and then you'll need the RESTORE command from the same
DOS version to be able to read that |nbackup|n file.
The |tFile Creation Error|t Message
This message comes when DOS tries to create a file and fails. This can
happen for several reasons. The most common, at least for me, is when
you try to COPY a file over top of another file, but the target copy has
its Read-only attribute set. Well what happens is that first DOS tries
to copy the new file over the old one, but since the old one is Read-only
that won't work, so DOS tries to create a new file by that same name.
But since you can't have more than one file by the same name in one dir-
ectory, that causes this error. If this happens to you, use the ATTRIB
command to remove the Read-only attribute from that target file, and then
you'll be able to copy over it. Think about it for a second first though
because there must be a reason for having had its Read-only attribute set
in the first place.
Another thing that can cause this error is if the disk is full, or if the
root directory is full. Remember you can only have a limited number of
files in a |nroot|n |ndirectory|n. But if you're trying to copy a file to a sub-
|ndirectory|n, and none of these other reasons pan out, then use the CHKDSK
command to see if the subdirectory has a problem of some sort.
PLEASE IGNORE THIS PAGE!
|TSHELL|T|fSIMPLY1|f
|t". and .."|t|fSIMPLY1|f
|t286|t|fSIMPLY1|f
|tANSI.SYS|t|fSIMPLY1|f
|tATTRIB|t|fSIMPLY1|f
|tAUTOEXEC.BAT|t|fSIMPLY1|f
|tAttributes|t|fSIMPLY1|f
|tBACKUP|t|fSIMPLY1|f
|tBBS|t|fSIMPLY1|f
|tCHKDSK|t|fSIMPLY1|f
|tCMOS|t|fSIMPLY1|f
|tCOMSPEC|t|fSIMPLY1|f
|tDISKCOPY|t|fSIMPLY1|f
|tDirectory|t|fSIMPLY1|f
|tEnvironment|t|fSIMPLY1|f
|tExpanded|t|fSIMPLY1|f
|tExtended|t|fSIMPLY1|f
|tHIMEM.SYS|t|fSIMPLY1|f
|tHidden files|t|fSIMPLY1|f
|tIBMBIO.COM|t|fSIMPLY1|f
|tIBMDOS.COM|t|fSIMPLY1|f
|tIO.SYS|t|fSIMPLY1|f
|tMSDOS.SYS|t|fSIMPLY1|f
|tMemory|t|fSIMPLY1|f
|tNon system disk|t|fSIMPLY1|f
|tRAM|t|fSIMPLY1|f
|tRMDIR|t|fSIMPLY1|f
|tROM|t|fSIMPLY1|f
|tShareware|t|fSIMPLY1|f
|tbytes|t|fSIMPLY1|f
|tconventional|t|fSIMPLY1|f
|tcurrent|t|fSIMPLY1|f
|tdefault|t|fSIMPLY1|f
|toverlay|t|fSIMPLY1|f
|troot|t|fSIMPLY1|f
|TCLS|T|fSIMPLY3|f
|TCOMP|T|fSIMPLY3|f
|TCON|T|fSIMPLY3|f
|TCOPY|T|fSIMPLY3|f
|TDEBUG|T|fSIMPLY3|f
|TDEVIC|1E|T|fSIMPLY3|f
|TDIR|T|fSIMPLY3|f
|TNUL|T|fSIMPLY3|f
|tBad command or filename|t|fSIMPLY3|f
|tPATH|t|fSIMPLY3|f
|TECHO|T|fSIMPLY4|f
|TEDIT|T|fSIMPLY4|f
|TFC|T|fSIMPLY4|f
|TFDISK|T|fSIMPLY4|f
|TLASTDRIVE|T|fSIMPLY4|f
|tPark|t|fSIMPLY4|f
|TDOSSHELL|T|fSIMPLY5|f
|TGWBASIC|T|fSIMPLY5|f
|TMIRROR|T|fSIMPLY5|f
|TPOST|T|fSIMPLY5|f
|TSHARE|T|fSIMPLY5|f
|TUNFORMAT|T|fSIMPLY5|f
|TVERIFY|T|fSIMPLY5|f
|TVOL|T|fSIMPLY5|f
|tBoot|t|fSIMPLY5|f
|tCOMMAND.COM|t|fSIMPLY5|f
|tReboot|t|fSIMPLY5|f
|tWildcards|t|fSIMPLY5|f
|TQBASIC|T|fSIMPLY6|f
|TTYPE|T|fSIMPLY6|f
|tCONFIG.SYS|t|fSIMPLY6|f
|tFAT|t|fSIMPLY6|f
|tKeyboard|t|fSIMPLY6|f
|tLogical Drives|t|fSIMPLY6|f
|tRedirection|t|fSIMPLY6|f
|tTSR|t|fSIMPLY6|f
|tBatch File|t|fSIMPLY7|f
|tDevice Driver|t|fSIMPLY3|f
|tPROMPT|t|fSIMPLY6|f
|tdecimal|t|fSIMPLY6|f
|TGOTO|T|fSIMPLY4|f
|TCTTY|T|fSIMPLY3|f